Optimizations of Bottom-Up Evaluation with Non-Ground Terms
نویسندگان
چکیده
Bottom-up evaluation of logic programs can be seen as an implementation of memoization. Memoization helps detect loops, avoid repeated computation when subgoals are generated repeatedly, and in conjunction with a fair search strategy, as in bottom-up evaluation, ensures that evaluation is complete. Programs that generate non-ground facts (i.e., facts containing universally quantiied variables) and also need memoization are important in several contexts such as the implementation of meta-interpreters, abstract interpretation and partial evaluation. Current bottom-up evaluation techniques (and other memoing techniques), while eecient for programs that generate only ground facts, are very ineecient for programs that generate non-ground facts. In this paper we present an eecient bottom-up evaluation technique for programs that generate non-ground facts. The technique includes a combination of a modiied Magic rewriting technique, and a run-time evaluation technique that incorporates several new optimizations. The technique maintains extra information with query and answer facts in order to speed upànswer-return' uniications. The technique has been implemented, and enables us to run some programs faster (asymptotically and practically) than using either Prolog or unoptimized bottom-up evaluation. The underlying ideas can also be used to adapt other memoing strategies (e.g., QSQR, Alexander Templates) with similar gains in eeciency. We also show that bottom-up evaluation can be implemented with a time cost that is within a log log factor of Prolog, (or a log factor using our simpler implementation) for all queries on deenite clause programs; conversely, there are programs where bottom-up evaluation is arbitrarily better than Prolog. These results provide important insight into the relation between bottom-up evaluation and top-down evaluation, and signiicantly extend earlier results on the subject. 0 This paper has an appendix containing details that may be useful to the referees. However, the paper is self-contained without the appendix and the appendix does not form a part of the paper.
منابع مشابه
Optimizations of Bottom - Up Eval
Memoization, such as that performed by bottom-up evaluation, helps detect loops, avoid repeated computation when subgoals are generated repeatedly, and in conjunction with a fair search strategy, ensures that evaluation is complete. Programs that generate non-ground facts (i.e., facts containing universally quantiied variables) and also need memoization are important in several contexts. Curren...
متن کاملMagic Computation for Wll-founded Semantics
We propose a new realization of goal-directed query evaluation of (non-oundering) normal logic programs for the well-founded semantics. To this end we introduce a new magic templates transformation and give a new xed point characterization of the well-founded semantics, lifting an existing deenition from the ground to the non-ground case. The new xed point characterization enables us to show a ...
متن کاملMagic for Filter Optimization in Dynamic Bottom-up Processing
Off-line compilation of logic grammars using Magic allows an incorporation of filtering into the logic underlying the grammar. The explicit definite clause characterization of filtering resulting from Magic compilation allows processor independent and logically clean optimizations of dynamic bottom-up processing with respect to goal-directedness. Two filter optimizations based on the program tr...
متن کاملBottom-Up Query Evaluation with Partially Ordered Defaults
We propose a query-evaluation algorithm for database specifications consisting of overridable rules (defaults) and non-overridable rules (axioms). Both kinds of rules may contain disjunctions. Preferences among the defaults are given by a partial order which corresponds to a subclass relationship allowing multiple inheritance. We use a bottomup theorem proving procedure. It is applied to the se...
متن کاملOptimizing Bottom-Up Evaluation of Constraint Queries
We consider a class of constraint logic programs including negation that can be executed bottom up without constraint solving, by replacing constraints with tests and assignments. We show how to optimize the bottom-up evaluation of queries for such programs using transformations based on analysis obtained using abstract interpretation. Although the paper concentrates on a class of eeciently exe...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1993